<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="keywords" content="" /> 
<meta name="description" content="" />
<title>免费开店     申请实体店</title>
<link type="text/css" href="../css/reset.css" rel="stylesheet" />
<link type="text/css" href="../css/public.css" rel="stylesheet" />
<link type="text/css" href="../css/style.css" rel="stylesheet" />
<link type="text/css" href="../css/wode.css" rel="stylesheet" />
<script>
    var deviceWidth = Math.min(640, window.innerWidth)
    document.documentElement.style.fontSize = deviceWidth / 7.5 + "px"
</script>
 <script src="../js/jquery.min.js?v=2.1.4"></script>
 <script src="../js/core.js"></script>
<!--<script src="../js/14.0.0shenqingshitian.js"></script>-->
</head>
<body>
<!-- top -->
<div class="header">
    <header class="p_header public-red">
        <a href="javascript:history.go(-1);" class="p_header_left">
            <i class="p_left" title="返回"></i>
        </a>
        <h1 class="p_dizhi">工厂店</h1>
    </header>
</div>
<!--免费开店-->
<form>
	<!--头像-->
	<input type="text"  id="touxiang"/>
	<input type="hidden" id="fengmian" />
	<input type="hidden" id="shangquanid"/>
	<div class="buy_fabu" style="margin-top: 0;">
	    <ul class="geren_touxiang">
	        <li class="clearfix">
	            <label>头像</label>
	            <div class="fabu_geren">
	                <div id="preview">
	                    <img id="imghead" border=0 src="../images/morne_touxiang.png" />
	                </div>
	                <div class="fabu_file"><input type="file" onchange="previewImage(this)" /></div>
	            </div>
	        </li>
	    </ul>
	</div>
	<!--店铺实拍图-->
	<div class="dingdan_title">店铺实拍图<span>查看示例图</span></div>
	<!--示例图-->
    <div class="pbulic-shili">
    	<img src="../images/mingpian.png" />
    	<img src="../images/mingpian.png" />
    </div>
	<div class="kaidian_dianpu">
		<p>实拍图上所有的信息清晰可见，必须能看清楚【招牌】,【档口号】以及店铺【整齐的陈列】</p>
		<div class="fabu_dianpu">
			<div id="preview1">
	            <img id="imghead1" border=0 src="../images/dianputu.png" />
	        </div>
	        <div class="fabu_file1"><input type="file" onchange="previewImage1(this)" /></div>
		</div>
	</div>
	<!--店铺信息-->
	<div class="dingdan_title">店铺信息</div>
    <ul class="a_order_inform mid-width">
        <li>
            <span>店铺名称</span>
            <input type="text" placeholder="店铺名称一旦填写无法更改" id="storeName">
        </li>
        <li>
            <span>联系人</span>
            <input type="text" placeholder="请输入店铺联系人" id="userName">
        </li>
        <li class="a_last_one">
            <span>联系电话</span> 
            <input type="number"  placeholder="请输入号码" id="phone" />
        </li>
    </ul>
    <!--档口信息-->
	<div class="dingdan_title">档口信息(提交后不可更改)</div>
    <ul class="a_order_inform mid-width">
        <li class="a_right_img">
            <span>地区</span> 
            <div id='cityResult3' class="dingdan_button"></div>
            <button id='showCityPicker3' class="mui-btn mui-btn-block" type='button'>三级联动示例 ...</button>
        </li>
        <li class="a_right_img">
            <span>详细地址</span> 
           <input type="text" id="xiangxidizhi placeholder="请输入详细地址"/>
        </li>
        <li class="a_right_img zhiweifabu04">
            <span>所属商圈</span>
            <em id="sqnames" class="xingbie" onclick="shangquans()">请选择批所在商圈</em>
            <div class="payment_time_mask payment_time_mask04" id="xialakuang" >
                <div class="pay_ttl">
                    <h4>商圈</h4>
                    <span>取消</span>
                </div>
                <ul id="shangquanxinxi">
                    
                </ul>
            </div>
            <!--<input type="text" placeholder="请输入您所在的批发市场">-->
        </li>
        <li class="a_last_one">
            <span>档口编号</span>
            <input type="text" id="addressnumber" placeholder="请输入您的档口编号">
        </li>
    </ul>
    <!--批发设置-->
    
    <input type="hidden" id="hunpi" value="0"/>
    <input type="hidden" id="baohuan" value="0"/>
	<div class="dingdan_title">批发设置</div>
    <ul class="a_order_inform mid-width">
       <li class="a_right_img zhiweifabu01">
            <span>主营类别</span> 
            <em class="leibiefuns" onclick="zhuyingleibies()">请选择主营类别</em>
            <div class="payment_time_mask payment_time_mask01">
                <div class="pay_ttl">
                    <h4>主营类别</h4>
                    <span>取消</span>
                </div>
                <ul id="zhuyingleibie">
                  
                </ul>
            </div>
        </li>
        
        
        <li>
            <span>拿货起批量</span>
            <input type="text" id="getmin" placeholder="输入“1”视为开通一件拿货服务">
        </li>
        <li>
            <span>打包起批量</span>
            <input type="text" id="packMin" placeholder="至少5件">
        </li>
        <li>
            <span>支持混批</span>
            <div class="fl jg_swith">
            	<div class="mui-switch mui-switch-mini" onclick="shifouhunpi(this)">
            		<div class="mui-switch-handle"></div>
				</div>
            </div>
        </li>
        <li>
            <span>支持包换</span>
            <div class="fl jg_swith">
            	<div class="mui-switch mui-switch-mini" onclick="baohuans(this)">
            		<div class="mui-switch-handle"></div>
				</div>
            </div>
            <p class="fr" style="margin-bottom: 0;">交易中允许买家换货</p>
        </li>
      <!--  <li class="a_last_one">
            <span>推广代码</span>
            <input type="text" id="spreadcode" placeholder="可不填">
        </li>-->
    </ul>
    <div class="dizhi_add mid-width clearfix">
        <div class="fl">
            <input type="checkbox" id="checkbox-1-1" class="regular-checkbox" checked /><label for="checkbox-1-1"></label>
        </div>
        <span>同意<a href="#" class="buy_xieyi">《入驻协议》</a></span>
    </div>
</form>

<!--底部-->
<div class="mid-width">
    <input type="button" class="p_button" onclick="xiayibu()" value="下一步">
</div>
<input type="hidden" value="0" id="zhuyingleibieid"/>
<div id="bg"></div>
<script type="text/javascript" src="../js/jquery-1.10.1.min.js" ></script>
<script type="text/javascript" src="../js/upload.js" ></script>
<link rel="stylesheet" href="../css/mui.min.css">
<!--App自定义的css-->
<link rel="stylesheet" type="text/css" href="../css/app.css" />
<link href="../css/mui.picker.css" rel="stylesheet" />
<link href="../css/mui.poppicker.css" rel="stylesheet" />
<script src="../js/mui.min.js"></script>
<!--<script src="../js/mui.picker.min.js"></script>-->
<script src="../js/mui.picker.js"></script>
<script src="../js/mui.poppicker.js"></script>
<script src="../js/city.data.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/city.data-3.js" type="text/javascript" charset="utf-8"></script>
<script>
	(function($, doc) {
		$.init();
		$.ready(function() {
			//					//级联示例
			var cityPicker3 = new $.PopPicker({
				layer: 3
			});
			cityPicker3.setData(cityData3);
			var showCityPickerButton = doc.getElementById('showCityPicker3');
			var cityResult3 = doc.getElementById('cityResult3');
			showCityPickerButton.addEventListener('tap', function(event) {
				cityPicker3.show(function(items) {
					cityResult3.innerText = (items[0] || {}).text + "-" + (items[1] || {}).text + "-" + (items[2] || {}).text;
					//返回 false 可以阻止选择框的关闭
					//return false;
				});
			}, false);
		});
	})(mui, document);
	
	
	
	$(function(){
		//弹出
		$('.dingdan_title span').on('click',function(){		
			$("body").append("<div id='mask'></div>");
        	$(".pbulic-shili").show();
		});
		//点击关闭
	    $(".pbulic-shili").on('click',function(){
	        $(".pbulic-shili").hide();
	        $("#mask").remove();
	    }) 
	});
	
	
	
	//主营类别弹窗
    $(function () {
	    $(".zhiweifabu01 em").click(function () {
	    	//alert("123");
	        $("#bg").css({
	            display: "block", height: $(document).height()
	        });
	        var $box = $('.payment_time_mask01');
	        $box.css({
	            display: "block",
	        });
	        $(".zhiweifabu01 i").addClass("up");
	    });
	    //点击关闭按钮的时候，遮罩层关闭
	    $(".payment_time_mask01 li").on('click',function () {
	        $("#bg,.payment_time_mask01").css("display", "none");
	        $(".zhiweifabu01 em").text($(this).html());
	        $(".zhiweifabu01 i").removeClass("up").addClass("down");
	    });
	});
	
	
	
    $(".pay_ttl span").on('click',function () {
    	$("#bg,.payment_time_mask04").css("display", "none");
        $("#bg,.payment_time_mask01").css("display", "none");
    });
</script>

<script>

	//hunpi
	function shifouhunpi(te){
		  $("#hunpi").val("0");
		if($(te).attr("class")!="mui-switch mui-switch-mini"){
		   $("#hunpi").val("1");	
		}
	}
	//包换
	function baohuans(te){
		$("#baohuan").val("0");
	   if($(te).attr("class")!="mui-switch mui-switch-mini"){
		   $("#baohuan").val("1");	
		}
	}
	
	
</script>
<script>
		wx.ready(function(){
		wx.getLocation({
			type:"gcj02",
	        success: function (res) {
	        	     latitude = res.latitude; // 纬度，浮点数，范围为90 ~ -90
			         longitude = res.longitude; // 经度，浮点数，范围为180 ~ -180。
			        var speed = res.speed; // 速度，以米/每秒计
			        var accuracy = res.accuracy; // 位置精度
	       alert(latitude+"***"+latitude);
//	               loadData(null,null,1);//加载数据
              // selectByusers();
	        },
	        fail: function(error) {
	            alert("获取地理位置失败，请确保开启GPS且允许微信获取您的地理位置！");
	        }
	    });
	    // config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中。
	wx.error(function(res){
    // config信息验证失败会执行error函数，如签名过期导致验证失败，具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，对于SPA可以在这里更新签名。
});
	});
</script>

<script>
	
	

function xiayibu(){
	  
	    if($("#checkbox-1-1").get(0).checked){
	    	  var zhuyingleibieid=$("#zhuyingleibieid").val();/*主营类别*/
	   var shangquanid=$("#shangquanid").val();
	    var touxiang=$("#touxiang").val();
	    var fengmian=$("#fengmian").val();
	    var storeName=$("#storeName").val();
	    var userName=$("#userName").val();
	    var phone=$("#phone").val();
	    var cityResult3=$("#cityResult3").html();
	    var spreadcode=$("#spreadcode").val();
	     var province="";
       var city="";
       var county="";
	       if(cityResult3!=""){
	       		var imgarr1 = cityResult3.split("-");
	       		$.each(imgarr1, function(index, value) {
                  if(index==0){
                  	 province+=value;
                  }else if(index==1){
                  	city+=value;
                  }else if(index==2){
                  	county+=value;
                  }
	       		});
	       }
	    var addressnumber=$("#addressnumber").val();
	   // var zhuyingleibie=$("#zhuyingleibie").val();
	    var getmin=$("#getmin").val();
	    var packMin=$("#packMin").val();
	    var hunpi=$("#hunpi").val();
	    var baohuan=$("#baohuan").val();
	    var xiangxidizhi=$("#xiangxidizhi").val();
	    var spreadcode=$("#spreadcode").val();
	    if($("#checkbox-1-1").attr("checked")){
	    	   $.ajax({  
        url : urlcore + "/api/shopInfo/adds4",
        type : "post",  
        contentType: "application/json;charset=utf-8",
        data :  JSON.stringify({
        	  "userId":uuuuid,
              "sellerType":2,
              "headImg":touxiang,
               "storeImg":fengmian,
               "storeName":storeName,
               "userName":userName,
               "phone":phone,
               "province":province,
               "city":city,
               "county":county,
                "addressNumber":addressnumber,
                 "getMin":getmin,
                  "packMin":packMin,
                 "tradeAreaId":shangquanid, //商圈id
                 "isMix":hunpi,
                 "isChange":baohuan,
                  "spreadCode":spreadcode,
                  "lng":longitude,   //经度
                  "lat":latitude,      //维度*/
                 "address":xiangxidizhi,
                  "sortTypeId":zhuyingleibieid /*主营类别*/
        	}),
        	dataType: "json",
        success: function(data) {//data是返回的hash,key之类的值，key是定义的文件名 
        	if (data.success == true) {
         window.location.href="16.1.0shenqing_wangluodian_jiaona.html"; 
        	}else{
        		alert(data.msg);
        		 //  window.location.href="12.0.0buy_wode.html";  
        	}
         
        },
        error:function(){  
            alert("提交失败");  
        }  
    }); 
	    }else{
	    	alert("入驻协议未同意");
	    }
}else{
	alert("未选中同意开通");
}
	    }




var latitude="",longitude="";



function  shangquans(){
       	$("#shangquanxinxi").html("");
	    $.ajax({
        url:urlcore+"/api/tradeArea/selectList",
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					$("#xialakuang").show();
				$.each(data.data,function(y,h){
					var shangquanxinxi='<li onclick="selectshangquan('+h.id+',\''+h.areaName+'\')" id="'+h.id+'" >'+h.areaName+'</li>';
			    $("#shangquanxinxi").append(shangquanxinxi);
					});
				}
			},
			error: function() {
				alert("error");
			}
		});
		//批发市场弹窗
    $(function () {
	    $(".zhiweifabu04 em").click(function () {
	        $("#bg").css({
	            display: "block", height: $(document).height()
	        });
	        var $box = $('.payment_time_mask04');
	        $box.css({
	            display: "block",
	        });
	        $(".zhiweifabu04 i").addClass("up");
	    });
	  
	});
	
}

function selectshangquan(id,name){
	$(".xingbie").html("请选择批发市场");
	$("#shangquanid").val("");
	$("#sqnames").html(name);
	$("#shangquanid").val(id);
	//$("#pfsq span").removeClass('up');  //点击关闭按钮的时候，遮罩层关闭
	        $("#bg,.payment_time_mask04").css("display", "none");
	        $(".zhiweifabu04 em").text($(this).html());
	        $(".zhiweifabu04 i").removeClass("up").addClass("down");
	    //$(".payment_time_mask04 li").on('click',function () {});
}

	
	function leibiefun(id,name){
	$(".leibiefuns").html("请选择主营类别");
	$("#zhuyingleibieid").val("");
	$(".leibiefuns").html(name);
	$("#zhuyingleibieid").val(id);
	//$("#pfsq span").removeClass('up');  //点击关闭按钮的时候，遮罩层关闭
	        $("#bg,.payment_time_mask01").css("display", "none");
	        $(".zhiweifabu01 em").text($(this).html());
	        $(".zhiweifabu01 i").removeClass("up").addClass("down");
	    //$(".payment_time_mask04 li").on('click',function () {});
	}
	
	 function zhuyingleibies(){
       	$("#zhuyingleibie").html("");
	    $.ajax({
        url:urlcore+"/api/sortType/selectList",
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
				/*	$("#xialakuang").show();*/
				$.each(data.data.list,function(y,h){
					var zhuyingleibie='<li onclick="leibiefun('+h.id+',\''+h.sortName+'\')" id="'+h.id+'" >'+h.sortName+'</li>';
			    $("#zhuyingleibie").append(zhuyingleibie);
					});
				}
			},
			error: function() {
				alert("error");
			}
		});
		//批发市场弹窗
    $(function () {
	    $(".zhiweifabu01 em").click(function () {
	        $("#bg").css({
	            display: "block", height: $(document).height()
	        });
	        var $box = $('.payment_time_mask01');
	        $box.css({
	            display: "block",
	        });
	        $(".zhiweifabu01 i").addClass("up");
	    });
	});
	
	 }
	

</script>

</body>
</html>